home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-18 | 2.8 KB | 113 lines | [TEXT/MMCC] |
- //
- // CTCPApplication.cp
- //
- // TurboTCP library
- // Application subclass
- // TCL-specific class
- //
- // Copyright © 1993-95, FrostByte Design / Eric Scouten
- //
-
- #include "CTCPApplication.h"
-
- #if !TurboTCP_TCL
- #error: This file should be used with TCL projects only!
- #endif
-
- #include "UTurboTCP.h"
-
- extern Boolean gInBackground;
-
- TCL_DEFINE_CLASS_M1(CTCPApplication, CApplication);
-
- //***********************************************************
-
- CTCPApplication::CTCPApplication()
- { }
-
- CTCPApplication::CTCPApplication
- (short extraMasters, // how many calls to MoreMasters
- // I recommend a higher than usual value here…
- Size aRainyDayFund, // size of TCL’s “rainy day” fund
- Size aCriticalBalance, // same as for CApplication::IApplication
- Size aToolboxBalance) // same as for CApplication::IApplication
-
- : CApplication(extraMasters, aRainyDayFund, aCriticalBalance, aToolboxBalance)
- { }
-
-
- //***********************************************************
-
- void CTCPApplication::ITCPApplication
- (short extraMasters, // how many calls to MoreMasters
- // I recommend a higher than usual value here…
- Size aRainyDayFund, // size of TCL’s “rainy day” fund
- Size aCriticalBalance, // same as for CApplication::IApplication
- Size aToolboxBalance) // same as for CApplication::IApplication
-
- // old-style constructor retained for compatibility
-
- {
- CApplication::IApplication(extraMasters, aRainyDayFund, aCriticalBalance,
- aToolboxBalance);
- }
-
-
- //***********************************************************
-
- void CTCPApplication::MakeHelpers()
-
- // Overriden to add the TCP driver to the list of "helpers."
-
- {
- // do standard TCL initialization
-
- CApplication::MakeHelpers();
-
- // set some default values
-
- cMaxSleepTime = 90; // don’t want to sleep for very long
- // ALSO, must set the “Background Null Events”
- // checkbox under Set Project Type…
- // (SIZE flags)
-
- maxTCPEvents = 0; // use TurboTCP’s default event count/tick count
- maxTCPTicks = 0; // as defined in UTurboTCP::ProcessNetEvents()
-
- // initialize TCP driver
-
- UTurboTCP::InitTCP();
-
- }
-
-
- // -- application shutdown --
-
- //***********************************************************
-
- Boolean CTCPApplication::Quit()
-
- // Dispose of the TCP driver object. Return true if quit was confirmed by each window.
-
- {
- Boolean reallyQuitting = CApplication::Quit();
- if (reallyQuitting)
- UTurboTCP::CloseTCP();
- return reallyQuitting;
- }
-
-
- // -- foreground/background event trapping --
-
- //***********************************************************
-
- void CTCPApplication::Process1Event()
-
- // Here we tap into the event loop to process TCP completions and notifications, now freed
- // from interrupt-level constraints on memory management.
-
- {
- UTurboTCP::ProcessNetEvents(maxTCPEvents, maxTCPTicks, gInBackground);
- CApplication::Process1Event();
- }
-